package sk.avicularia.core.data;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import sk.avicularia.core.dao.AccessDAO;
import sk.avicularia.core.dao.DocumentTypeAccessDAO;
import sk.avicularia.core.dao.DocumentTypeDAO;

@Entity
@Table(name = DocumentTypeAccessDAO.TABLE_NAME)
public class DocumentTypeAccess implements Serializable
{

	/**
	 * @see Serializable
	 */
	private static final long	serialVersionUID	= -8746003205274862500L;

	/**
	 * Id zaznamu
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID", nullable = false)
	private Long id;
	
	/**
	 * typ dokumentu
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = DocumentTypeAccessDAO.COLUMN_ID_DOCUMENT_TYPE, referencedColumnName = "ID", table = DocumentTypeDAO.TABLE_NAME)
	private DocumentType documentType;
	
	/**
	 * Pravo pre dany typ dokumentu
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = DocumentTypeAccessDAO.COLUMN_ID_ACCESS, referencedColumnName = "ID", table = AccessDAO.TABLE_NAME)
	private Access access;

	public Long getId()
	{
		return id;
	}

	public void setId(Long id)
	{
		this.id = id;
	}

	public DocumentType getDocumentType()
	{
		return documentType;
	}

	public void setDocumentType(DocumentType documentType)
	{
		this.documentType = documentType;
	}

	public Access getAccess()
	{
		return access;
	}

	public void setAccess(Access access)
	{
		this.access = access;
	}
}
